home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / createImageFormats.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.5 KB  |  139 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //==================================================================
  18. //
  19. // Set up the global arrays that contain the image format extensions.
  20. // This has to be separated from the Menu building
  21. // code, because other areas of Maya need to access these arrays and if
  22. // this is tied into the building of the menus, they can't do this.
  23. //
  24. // NOTE !!!! WARNING !!!!
  25. // If you make a change to the code in this procedure, you also need
  26. // to make the corresponding change in the 'createImageFile' procedure
  27. // of renderGlobalsWindow.mel.
  28. //
  29. // This code is also called from dynPaintMenus.mel since it may
  30. // be required for PFX canvas saving.
  31. //
  32. //==================================================================
  33. global proc createImageFormats( )
  34. {
  35.     global string $imgExt[18];  // This is the actual file extension
  36.     global int $imgExtNum[18];  // This is the corresponding internal value
  37.  
  38.     if (`about -nt`) {
  39.         $imgExt[0]  = "als";  $imgExtNum[0]  = 6;
  40.         $imgExt[1]  = "avi";  $imgExtNum[1]  = 23;
  41.         $imgExt[2]  = "cin";  $imgExtNum[2]  = 11;
  42.         $imgExt[3]  = "eps";  $imgExtNum[3]  = 9;
  43.         $imgExt[4]  = "gif";  $imgExtNum[4]  = 0;
  44.         $imgExt[5]  = "jpeg"; $imgExtNum[5]  = 8;
  45.         $imgExt[6]  = "iff";  $imgExtNum[6]  = 7;
  46.         $imgExt[7]  = "iff";  $imgExtNum[7]  = 10;
  47.         $imgExt[8]  = "yuv";  $imgExtNum[8]  = 12;
  48.         $imgExt[9]  = "rla";  $imgExtNum[9]  = 2;
  49.         $imgExt[10] = "sgi";  $imgExtNum[10] = 5;
  50.         $imgExt[11] = "sgi";  $imgExtNum[11] = 13;
  51.         $imgExt[12] = "pic";  $imgExtNum[12] = 1;
  52.         $imgExt[13] = "tga";  $imgExtNum[13] = 19;
  53.         $imgExt[14] = "tif";  $imgExtNum[14] = 3;
  54.         $imgExt[15] = "tif";  $imgExtNum[15] = 4;
  55.         $imgExt[16] = "bmp";  $imgExtNum[16] = 20;
  56.     } else if (`about -irix`)  {
  57.         $imgExt[0]  = "als";  $imgExtNum[0]   = 6;
  58.         $imgExt[1]  = "avi";  $imgExtNum[1]   = 23;
  59.         $imgExt[2]  = "cin";  $imgExtNum[2]   = 11;
  60.         $imgExt[3]  = "eps";  $imgExtNum[3]   = 9;
  61.         $imgExt[4]  = "gif";  $imgExtNum[4]   = 0;
  62.         $imgExt[5]  = "jpeg"; $imgExtNum[5]   = 8;
  63.         $imgExt[6]  = "iff";  $imgExtNum[6]   = 7;
  64.         $imgExt[7]  = "iff";  $imgExtNum[7]   = 10;
  65.         $imgExt[8]  = "yuv";  $imgExtNum[8]   = 12;
  66.         $imgExt[9]  = "qt";   $imgExtNum[9]   = 22;
  67.         $imgExt[10]  = "rla"; $imgExtNum[10]  = 2;
  68.         $imgExt[11] = "sgi";  $imgExtNum[11]  = 5;
  69.         $imgExt[12] = "sgi";  $imgExtNum[12]  = 13;
  70.         $imgExt[13] = "mv";   $imgExtNum[13]  = 21;
  71.         $imgExt[14] = "pic";  $imgExtNum[14]  = 1;
  72.         $imgExt[15] = "tga";  $imgExtNum[15]  = 19;
  73.         $imgExt[16] = "tif";  $imgExtNum[16]  = 3;
  74.         $imgExt[17] = "tif";  $imgExtNum[17]  = 4;
  75.         $imgExt[18] = "bmp";  $imgExtNum[18]  = 20; 
  76.     } else if (`about -linux`)  {
  77.         $imgExt[0]  = "als";  $imgExtNum[0]  = 6;
  78.         $imgExt[1]  = "cin";  $imgExtNum[1]  = 11;
  79.         $imgExt[2]  = "eps";  $imgExtNum[2]  = 9;
  80.         $imgExt[3]  = "gif";  $imgExtNum[3]  = 0;
  81.         $imgExt[4]  = "jpeg"; $imgExtNum[4]  = 8;
  82.         $imgExt[5]  = "iff";  $imgExtNum[5]  = 7;
  83.         $imgExt[6]  = "iff";  $imgExtNum[6]  = 10;
  84.         $imgExt[7]  = "yuv";  $imgExtNum[7]  = 12;
  85.         $imgExt[8]  = "rla";  $imgExtNum[8]  = 2;
  86.         $imgExt[9]  = "sgi";  $imgExtNum[9]  = 5;
  87.         $imgExt[10] = "sgi";  $imgExtNum[10] = 13;
  88.         $imgExt[11] = "pic";  $imgExtNum[11] = 1;
  89.         $imgExt[12] = "tga";  $imgExtNum[12] = 19;
  90.         $imgExt[13] = "tif";  $imgExtNum[13] = 3;
  91.         $imgExt[14] = "tif";  $imgExtNum[14] = 4;
  92.         $imgExt[15] = "bmp";  $imgExtNum[15] = 20; 
  93.     } else if (`about -mac`)    {
  94.         $imgExt[0]  = "jpeg"; $imgExtNum[0]  = 8;
  95.         $imgExt[1]  = "iff";  $imgExtNum[1]  = 7;
  96.         $imgExt[2]  = "iff";  $imgExtNum[2]  = 10;
  97.         $imgExt[3]  = "pntg"; $imgExtNum[3]  = 30;
  98.         $imgExt[4]  = "ps";      $imgExtNum[4]  = 31;
  99.         $imgExt[5]  = "png";  $imgExtNum[5]  = 32;
  100.         $imgExt[6]  = "pict"; $imgExtNum[6]  = 33;
  101.         $imgExt[7]  = "qt";   $imgExtNum[7]  = 22;
  102.         $imgExt[8]  = "qtif"; $imgExtNum[8]  = 34;
  103.         $imgExt[9]  = "sgi";  $imgExtNum[9]  = 5;
  104.         $imgExt[10] = "tga";  $imgExtNum[10] = 19;
  105.         $imgExt[11] = "tif";  $imgExtNum[11] = 3;
  106.         $imgExt[12] = "bmp";  $imgExtNum[12] = 20;    
  107.     } else    {
  108.         warning "Unsupported platform in createImageFormats.mel";
  109.     }
  110. }
  111.  
  112. global proc string extOfImageFormat(int $imageFormatNum)
  113. {
  114.     //
  115.     // Description:
  116.     //    Given an image format number as would be found in
  117.     //    defaultRenderGlobals.imageFormat, this procedure returns the string
  118.     //    extension corresponding to that image format.
  119.     //    If the image format is not supported on the current platform, the
  120.     //    return value is the empty string.
  121.     //
  122.  
  123.     string $imageFormat = "";
  124.     int $i;
  125.     global string $imgExt[];
  126.     global int $imgExtNum[];
  127.  
  128.     for ($i = 0; $i < size($imgExt); $i++)
  129.     {
  130.         if ($imgExtNum[$i] == $imageFormatNum)
  131.         {
  132.             $imageFormat = $imgExt[$i];
  133.             break;
  134.         }
  135.     }
  136.  
  137.     return $imageFormat;
  138. }
  139.